package com.xnyzc.lhy.statistics.eenum;

import com.xnyzc.lhy.common.exception.PangException;
import com.xnyzc.lhy.common.penum.EErrorCode;
import com.xnyzc.lhy.common.util.CheckUtil;

public enum ECapacityOption {

    DRIVE_OUT(1, "出车司机数"),
    ANSWER(2, "应答司机数"),
    ORDER_FULFILLMENT(3, "完单司机数"),
    LENGTH_OF_DRIVING_TIME(4, "人均出车时长"),
    DAILY_ACTIVITY(5, "日活跃司机数"),
    TPH(6, "tph"),
    IPH(7, "iph");

    private Integer key;
    private String value;

    ECapacityOption(Integer key, String value) {
        this.key = key;
        this.value = value;
    }

    public static String value(Integer key) {
        if (CheckUtil.objIsNotEmpty(key)) {
            for (ECapacityOption examine : ECapacityOption.values()) {
                if (key.equals(examine.getKey())) {
                    return examine.getValue();
                }
            }
        }
        throw PangException.create(EErrorCode.noData);
    }

    public Integer getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }
}
